package com.zhentao.controller;

import com.zhentao.model.common.buiness.pojo.Category;
import com.zhentao.model.common.dtos.ResponseResult;
import com.zhentao.service.MaCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author 王越潇
 * @version 1.0
 * @Date 2024/9/17 21:37
 * @Type
 */
@RestController
@RequestMapping("ma/category")
@Api(tags = "maCategory",description = "管理端分类管理接口")
public class MaCategoryController {
    @Resource
    private MaCategoryService maCategoryService;
    @ApiOperation("管理端：分类列表")
    @GetMapping("findAll")
    public ResponseResult findAll(){
        return maCategoryService.findAll();
    }
    @ApiOperation("管理端：分类添加")
    @PostMapping("categoryAdd")
    public ResponseResult categoryAdd(@RequestBody Category category){
        return maCategoryService.categoryAdd(category);
    }
    @ApiOperation("管理端：分类修改")
    @PostMapping("categoryUpdate")
    public ResponseResult categoryUpdate(@RequestBody Category category){
        return maCategoryService.categoryUpdate(category);
    }
    @ApiOperation("管理端：分类删除")
    @GetMapping("categoryDelete/{id}")
    public ResponseResult categoryDelete(@PathVariable("id") Integer id){
        return maCategoryService.categoryDelete(id);
    }
    @ApiOperation("管理端：修改状态")
    @PostMapping ("updateStatus/{id}")
    public ResponseResult updateStatus(@PathVariable("id") Integer id){
        return maCategoryService.updateStatus(id);
    }

}
